package com.nbsaas.boot.evaluate.rest.convert;

import com.nbsaas.boot.entity.evaluate.EvaluateLike;
import com.nbsaas.boot.evaluate.api.domain.request.EvaluateLikeRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.entity.evaluate.Evaluate;
            import com.nbsaas.boot.jpa.data.entity.User;

/**
* 评价点赞请求对象转换成实体对象
*/

public class EvaluateLikeEntityConvert  implements Converter<EvaluateLike, EvaluateLikeRequest> {

    @Override
    public EvaluateLike convert(EvaluateLikeRequest source) {
        EvaluateLike result = new EvaluateLike();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getEvaluate()!=null){
                    Evaluate evaluate =new Evaluate();
                    evaluate.setId(source.getEvaluate());
                    result.setEvaluate(evaluate);
                    }
                    if(source.getUser()!=null){
                    User user =new User();
                    user.setId(source.getUser());
                    result.setUser(user);
                    }
        return result;
    }
}

